//    Copyright (C) 2013  <lugocreation@gmail.com>
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>
package org.jpgolay.wi.realestate;

import java.io.Serializable;
import java.math.BigDecimal;
import org.jpgolay.wi.persistence.ObjectCRUD;

// Referenced classes of package org.jpgolay.wi.realestate:
//            RealEstate
public class RealEstateCRUD
        implements Serializable {

    public RealEstateCRUD() {
        crud = new ObjectCRUD();
    }

    public boolean findByPrimaryKey(String id) {
        data = readRealEstate(new Integer(id));
        return data != null;
    }

    public boolean findByInternalRefAndAgenceId(String ref, String agencyId) {
        data = readRealEstateBy(ref, agencyId);
        return data != null;
    }

    public boolean modify() {
        return updateRealEstate();
    }

    public boolean create(String realEstateId) {
        Integer id = createRealEstate();
        if (id != null) {
            data = readRealEstate(id);
            return true;
        } else {
            return false;
        }
    }

    public boolean remove() {
        return deleteRealEstate();
    }

    public String getAscenseur() {
        return data.getElevator();
    }

    public void setAscenseur(String ascenseur) {
        data.setElevator(ascenseur);
    }

    public String getBalcon() {
        return data.getBalcony();
    }

    public void setBalcon(String balcon) {
        data.setBalcony(balcon);
    }

    public String getCategorie() {
        return data.getCategory();
    }

    public void setCategorie(String categorie) {
        data.setCategory(categorie);
    }

    public BigDecimal getCharges() {
        return data.getCharge();
    }

    public void setCharges(BigDecimal charges) {
        data.setCharge(charges);
    }

    public String getCommune() {
        return data.getCounty();
    }

    public void setCommune(String commune) {
        data.setCounty(commune);
    }

    public String getDateCreation() {
        return data.getCreate();
    }

    public void setDateCreation(String dateCreation) {
        data.setCreate(dateCreation);
    }

    public String getDateDispo() {
        return data.getAvailability();
    }

    public void setDateDispo(String dateDispo) {
        data.setAvailability(dateDispo);
    }

    public String getDepartement() {
        return data.getState();
    }

    public void setDepartement(String departement) {
        data.setState(departement);
    }

    public String getDescriptif() {
        return data.getDescription();
    }

    public void setDescriptif(String descriptif) {
        data.setDescription(descriptif);
    }

    public String getEtage() {
        return data.getFloor();
    }

    public void setEtage(String etage) {
        data.setFloor(etage);
    }

    public String getEtat() {
        return data.getCondition();
    }

    public void setEtat(String etat) {
        data.setCondition(etat);
    }

    public String getExposition() {
        return data.getAspect();
    }

    public void setExposition(String exposition) {
        data.setAspect(exposition);
    }

    public String getGarage() {
        return data.getGarage();
    }

    public void setGarage(String garage) {
        data.setGarage(garage);
    }

    public String getGenre() {
        return data.getSort();
    }

    public void setGenre(String genre) {
        data.setSort(genre);
    }

    public String getId() {
        return String.valueOf(data.getId());
    }

    public String getIdClient() {
        return String.valueOf(data.getIdCustomer());
    }

    public void setIdClient(String idClient) {
        data.setIdCustomer(new Integer(idClient));
    }

    public String getJardin() {
        return data.getGarden();
    }

    public void setJardin(String jardin) {
        data.setGarden(jardin);
    }

    public String getMeuble() {
        return data.getFurnished();
    }

    public void setMeuble(String meuble) {
        data.setFurnished(meuble);
    }

    public Integer getNbConsultCC() {
        return data.getNumConsultCC();
    }

    public void setNbConsultCC(int nbConsultCC) {
        data.setNumConsultCC(new Integer(nbConsultCC));
    }

    public Integer getNbConsultWeb() {
        return data.getNumConsultWeb();
    }

    public void setNbConsultWeb(int nbConsultWeb) {
        data.setNumConsultWeb(new Integer(nbConsultWeb));
    }

    public String getParking() {
        return data.getParking();
    }

    public void setParking(String parking) {
        data.setParking(parking);
    }

    public String getPays() {
        return data.getCountry();
    }

    public void setPays(String pays) {
        data.setCountry(pays);
    }

    public byte[] getPhoto1() {
        return data.getPhoto1();
    }

    public void setPhoto1(byte photo1[]) {
        data.setPhoto1(photo1);
    }

    public byte[] getPhoto2() {
        return data.getPhoto2();
    }

    public void setPhoto2(byte photo2[]) {
        data.setPhoto2(photo2);
    }

    public String getPhotoValid() {
        return data.getPhotosValid();
    }

    public void setPhotoValid(String photoValid) {
        data.setPhotosValid(photoValid);
    }

    public String getPiscine() {
        return data.getPool();
    }

    public void setPiscine(String piscine) {
        data.setPool(piscine);
    }

    public BigDecimal getPrixLoyer() {
        return data.getRent();
    }

    public void setPrixLoyer(BigDecimal prixLoyer) {
        data.setRent(prixLoyer);
    }

    public BigDecimal getPrixVente() {
        return data.getSale();
    }

    public void setPrixVente(BigDecimal prixVente) {
        data.setSale(prixVente);
    }

    public String getQuartier() {
        return data.getArea();
    }

    public void setQuartier(String quartier) {
        data.setArea(quartier);
    }

    public Integer getReference() {
        return data.getRef();
    }

    public void setRef(int ref) {
        data.setRef(new Integer(ref));
    }

    public Integer getSurfaceHabitable() {
        return data.getSurfaceFloor();
    }

    public void setSurfaceHabitable(int surfaceHabitable) {
        data.setSurfaceFloor(new Integer(surfaceHabitable));
    }

    public Integer getSurfaceTerrain() {
        return data.getSurfaceGround();
    }

    public void setSurfaceTerrain(int surfaceTerrain) {
        data.setSurfaceGround(new Integer(surfaceTerrain));
    }

    public String getTerrain() {
        return data.getPlot();
    }

    public void setTerrain(String terrain) {
        data.setPlot(terrain);
    }

    public String getTerrasse() {
        return data.getRoofgarden();
    }

    public void setTerrasse(String terrasse) {
        data.setRoofgarden(terrasse);
    }

    public String getType() {
        return data.getType();
    }

    public void setType(String type) {
        data.setType(type);
    }

    public String getViager() {
        return data.getLifeannuity();
    }

    public void setViager(String viager) {
        data.setLifeannuity(viager);
    }

    public String getVillegiature() {
        return data.getVacation();
    }

    public void setVillegiature(String villegiature) {
        data.setVacation(villegiature);
    }

    public String getAdresse1() {
        return data.getAddrLn1();
    }

    public void setAdresse1(String adresse1) {
        data.setAddrLn1(adresse1);
    }

    public String getAdresse2() {
        return data.getAddrLn2();
    }

    public void setAdresse2(String adresse2) {
        data.setAddrLn2(adresse2);
    }

    public BigDecimal getCaution() {
        return data.getDeposit();
    }

    public void setCaution(BigDecimal caution) {
        data.setDeposit(caution);
    }

    public String getCave() {
        return data.getCellar();
    }

    public void setCave(String cave) {
        data.setCellar(cave);
    }

    public String getChambre() {
        return data.getBedroom();
    }

    public void setChambre(String chambre) {
        data.setBedroom(chambre);
    }

    public String getChauffage() {
        return data.getHeating();
    }

    public void setChauffage(String chauffage) {
        data.setHeating(chauffage);
    }

    public String getCheminee() {
        return data.getFireplace();
    }

    public void setCheminee(String cheminee) {
        data.setFireplace(cheminee);
    }

    public String getClef() {
        return data.getKey();
    }

    public void setClef(String clef) {
        data.setKey(clef);
    }

    public String getClient() {
        return data.getCustomer();
    }

    public void setClient(String client) {
        data.setCustomer(client);
    }

    public String getCodePostal() {
        return data.getZip();
    }

    public void setCodePostal(String codePostal) {
        data.setZip(codePostal);
    }

    public String getCuisine() {
        return data.getKitchen();
    }

    public void setCuisine(String cuisine) {
        data.setKitchen(cuisine);
    }

    public String getDepartAccepte() {
        return data.getDeparture();
    }

    public void setDepartAccepte(String departAccepte) {
        data.setDeparture(departAccepte);
    }

    public String getDepartSouhaite() {
        return data.getDepartureCustomer();
    }

    public void setDepartSouhaite(String departSouhaite) {
        data.setDepartureCustomer(departSouhaite);
    }

    public String getDouche() {
        return data.getShower();
    }

    public void setDouche(String douche) {
        data.setShower(douche);
    }

    public BigDecimal getFraisAgence() {
        return data.getAgencyFees();
    }

    public void setFraisAgence(BigDecimal fraisAgence) {
        data.setAgencyFees(fraisAgence);
    }

    public String getHall() {
        return data.getHall();
    }

    public void setHall(String hall) {
        data.setHall(hall);
    }

    public String getLoggia() {
        return data.getLoggia();
    }

    public void setLoggia(String loggia) {
        data.setLoggia(loggia);
    }

    public String getLot() {
        return data.getBatch();
    }

    public void setLot(String lot) {
        data.setBatch(lot);
    }

    public String getMezzanine() {
        return data.getMezzanine();
    }

    public void setMezzanine(String mezzanine) {
        data.setMezzanine(mezzanine);
    }

    public String getObservationImprimee() {
        return data.getPrintObservation();
    }

    public void setObservationImprimee(String observationImprimee) {
        data.setPrintObservation(observationImprimee);
    }

    public String getObservation() {
        return data.getObservation();
    }

    public void setObservation(String observation) {
        data.setObservation(observation);
    }

    public String getOptionFisc() {
        return data.getOptionFisc();
    }

    public void setOptionFisc(String optionFisc) {
        data.setOptionFisc(optionFisc);
    }

    public String getOptions() {
        return data.getOption();
    }

    public void setOptions(String options) {
        data.setOption(options);
    }

    public String getPanneau() {
        return data.getPanel();
    }

    public void setPanneau(String panneau) {
        data.setPanel(panneau);
    }

    public byte[] getPhoto3() {
        return data.getPhoto3();
    }

    public void setPhoto3(byte photo3[]) {
        data.setPhoto3(photo3);
    }

    public byte[] getPhoto4() {
        return data.getPhoto4();
    }

    public void setPhoto4(byte photo4[]) {
        data.setPhoto4(photo4);
    }

    public byte[] getPhoto5() {
        return data.getPhoto5();
    }

    public void setPhoto5(byte photo5[]) {
        data.setPhoto5(photo5);
    }

    public byte[] getPhoto6() {
        return data.getPhoto6();
    }

    public void setPhoto6(byte photo6[]) {
        data.setPhoto6(photo6);
    }

    public byte[] getPhoto7() {
        return data.getPhoto7();
    }

    public void setPhoto7(byte photo7[]) {
        data.setPhoto7(photo7);
    }

    public byte[] getPhoto8() {
        return data.getPhoto8();
    }

    public void setPhoto8(byte photo8[]) {
        data.setPhoto8(photo8);
    }

    public byte[] getPhoto9() {
        return data.getPhoto9();
    }

    public void setPhoto9(byte photo9[]) {
        data.setPhoto9(photo9);
    }

    public byte[] getPhoto10() {
        return data.getPhoto10();
    }

    public void setPhoto10(byte photo10[]) {
        data.setPhoto10(photo10);
    }

    public String getPlacard() {
        return data.getCupboard();
    }

    public void setPlacard(String placard) {
        data.setCupboard(placard);
    }

    public BigDecimal getProvisionCharge() {
        return data.getChargeDeposit();
    }

    public void setProvisionCharge(BigDecimal provisionCharge) {
        data.setChargeDeposit(provisionCharge);
    }

    public String getRefInterne() {
        return data.getRefInternal();
    }

    public void setRefInterne(String refInternal) {
        data.setRefInternal(refInternal);
    }

    public String getReserve() {
        return data.getReserve();
    }

    public void setReserve(String reserve) {
        data.setReserve(reserve);
    }

    public String getResidance() {
        return data.getResidance();
    }

    public void setResidance(String residance) {
        data.setResidance(residance);
    }

    public String getSalleBain() {
        return data.getBathroom();
    }

    public void setSalleBain(String salleBain) {
        data.setBathroom(salleBain);
    }

    public String getSecteur() {
        return data.getSector();
    }

    public void setSecteur(String secteur) {
        data.setSector(secteur);
    }

    public String getSejour() {
        return data.getLivingroom();
    }

    public void setSejour(String sejour) {
        data.setLivingroom(sejour);
    }

    public String getStanding() {
        return data.getStanding();
    }

    public void setStanding(String standing) {
        data.setStanding(standing);
    }

    public String getSol() {
        return data.getStylefloor();
    }

    public void setSol(String sol) {
        data.setStylefloor(sol);
    }

    public String getSortant() {
        return data.getExitCustomer();
    }

    public void setSortant(String sortant) {
        data.setExitCustomer(sortant);
    }

    public String getVisibilite() {
        return data.getWeb();
    }

    public void setVisibilite(String visibilite) {
        data.setWeb(visibilite);
    }

    public String getWc() {
        return data.getRestroom();
    }

    public void setWc(String wc) {
        data.setRestroom(wc);
    }

    public String getLit() {
        return data.getBed();
    }

    public void setLit(String lit) {
        data.setBed(lit);
    }

    public void setTv(String tv) {
        data.setTv(tv);
    }

    public String getTv() {
        return data.getTv();
    }

    public String getArchive() {
        return data.getArchive();
    }

    public void setArchive(String archive) {
        data.setArchive(archive);
    }

    public Integer getSurfaceCuisine() {
        return data.getSKitchen();
    }

    public void setSurfaceCuisine(Integer surfaceCuisine) {
        data.setSKitchen(surfaceCuisine);
    }

    public Integer getSurfaceBalcon() {
        return data.getSBalcony();
    }

    public void setSurfaceBalcon(Integer surfaceBalcon) {
        data.setSBalcony(surfaceBalcon);
    }

    public Integer getSurfaceGarage() {
        return data.getSGarage();
    }

    public void setSurfaceGarage(Integer surfaceGarage) {
        data.setSGarage(surfaceGarage);
    }

    public Integer getSurfaceSejour() {
        return data.getSLivingroom();
    }

    public void setSurfaceSejour(Integer surfaceSejour) {
        data.setSLivingroom(surfaceSejour);
    }

    public Integer getSurfaceHall() {
        return data.getSHall();
    }

    public void setSurfaceHall(Integer surfaceHall) {
        data.setSHall(surfaceHall);
    }

    public Integer getSurfaceTerrasse() {
        return data.getSRoofgarden();
    }

    public void setSurfaceTerrasse(Integer surfaceTerrasse) {
        data.setSRoofgarden(surfaceTerrasse);
    }

    public Integer getSurfaceMezzanine() {
        return data.getSMezzanine();
    }

    public void setSurfaceMezzanine(Integer surfaceMezzanine) {
        data.setSMezzanine(surfaceMezzanine);
    }

    public Integer getSurfaceLoggia() {
        return data.getSLoggia();
    }

    public void setSurfaceLoggia(Integer surfaceLoggia) {
        data.setSLoggia(surfaceLoggia);
    }

    public Integer getSurfaceChambre() {
        return data.getSRoom();
    }

    public void setSurfaceChambre(Integer surfaceChambre) {
        data.setSRoom(surfaceChambre);
    }

    public Integer getSurfaceCave() {
        return data.getSCellar();
    }

    public void setSurfaceCave(Integer surfaceCave) {
        data.setSCellar(surfaceCave);
    }

    public Integer getSurfaceCellier() {
        return data.getSCellarWine();
    }

    public void setSurfaceCellier(Integer surfaceCellier) {
        data.setSCellarWine(surfaceCellier);
    }

    public String getLastUpdate() {
        return data.getLastUpdate();
    }

    public void setLastUpdate(String lastUpdate) {
        data.setLastUpdate(lastUpdate);
    }

    public Integer getAgencyId() {
        return data.getAgencyId();
    }

    public void setAgencyId(Integer agencyId) {
        data.setAgencyId(agencyId);
    }

    public String getCellier() {
        return data.getCellarWine();
    }

    public void setCellier(String cellier) {
        data.setCellarWine(cellier);
    }

    public String getMurs() {
        return data.getWalls();
    }

    public void setMurs(String murs) {
        data.setWalls(murs);
    }

    public String getDuplex() {
        return data.getDuplex();
    }

    public void setDuplex(String duplex) {
        data.setDuplex(duplex);
    }

    public RealEstate getData() {
        return data;
    }

    public void setData(RealEstate estate) {
        data = estate;
    }

    private Integer createRealEstate() {
        return crud.create(4);
    }

    private RealEstate readRealEstate(Integer id) {
        return (RealEstate) crud.read(id, 4);
    }

    private RealEstate readRealEstateBy(String arg0, String arg1) {
        return (RealEstate) crud.readBy(arg0, arg1, 4);
    }

    private boolean updateRealEstate() {
        return crud.update(data, 4);
    }

    private boolean deleteRealEstate() {
        boolean b = crud.delete(data.getId(), data.getLastUpdate(), 4);
        if (b) {
            data = null;
        }
        return b;
    }
    private RealEstate data;
    private ObjectCRUD crud;
}
